<?
include_once("test.php");
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN')
	dl('php_sdl.dll');
else 
	dl('sdl.so');
class test_b001 extends test{
	function do_test($idx) {
		switch($idx) {
		case 1:
			$this->show_exts();
			break;
		case 2:
			$this->show_functions("sdl");
			break;
		case 3:
			SDL_Init();
			break;
		case 4:
			echo "Starting\n";			
			$ret=SDL_Init(SDL_INIT_VIDEO);
			echo "SDL Init returns:";
			var_dump($ret);
			echo "\n";
			$ret=SDL_WasInit(SDL_INIT_EVERYTHING);
			echo "SDL WasInit returns:";
			if ($ret & SDL_INIT_VIDEO) {
				echo "OK";
			} else {
				echo "NO";
			}
			echo "\n";

			echo "SDL WasInit (test2) returns:";
			if (SDL_WasInit(SDL_INIT_VIDEO)!=0) {
				echo "OK";
			} else {
				echo "NO";
			}
			echo "\n";

			$ret=SDL_Quit();
			echo "SDL Quit returns:";
			var_dump($ret);
			echo "\n";			
			echo "Quitting\n";
			break;	
		}
	}
	function get_test_list() {
		return array(
			1=>"show all extensions",
			2=>"show extensions with sdl",			
			3=>"SDL_init (checking error reporting on arguments)",			
			4=>"SDL_init complete",			
		);
	}
}
?>
